<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
selection_test(
  '<div contenteditable dir="rtl">|Lorem\n        <div></div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">L|orem\n        <div></div>\n        ipsum</div>',
  '23-0 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">L|orem\n        <div></div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lo|rem\n        <div></div>\n        ipsum</div>',
  '23-1 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lo|rem\n        <div></div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lor|em\n        <div></div>\n        ipsum</div>',
  '23-2 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lor|em\n        <div></div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lore|m\n        <div></div>\n        ipsum</div>',
  '23-3 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lore|m\n        <div></div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem|\n        <div></div>\n        ipsum</div>',
  '23-4 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem|\n        <div></div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        |ipsum</div>',
  '23-5 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n|        <div></div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        |ipsum</div>',
  '23-6 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n |       <div></div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        |ipsum</div>',
  '23-7 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n  |      <div></div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        |ipsum</div>',
  '23-8 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n   |     <div></div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        |ipsum</div>',
  '23-9 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n    |    <div></div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        |ipsum</div>',
  '23-10 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n     |   <div></div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        |ipsum</div>',
  '23-11 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n      |  <div></div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        |ipsum</div>',
  '23-12 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n       | <div></div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        |ipsum</div>',
  '23-13 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        |<div></div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        |ipsum</div>',
  '23-14 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div>|</div>\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        i|psum</div>',
  '23-15 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div></div>|\n        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        i|psum</div>',
  '23-16 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n|        ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        i|psum</div>',
  '23-17 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n |       ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        i|psum</div>',
  '23-18 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n  |      ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        i|psum</div>',
  '23-19 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n   |     ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        i|psum</div>',
  '23-20 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n    |    ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        i|psum</div>',
  '23-21 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n     |   ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        i|psum</div>',
  '23-22 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n      |  ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        i|psum</div>',
  '23-23 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n       | ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        i|psum</div>',
  '23-24 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        |ipsum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        i|psum</div>',
  '23-25 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        i|psum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        ip|sum</div>',
  '23-26 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        ip|sum</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        ips|um</div>',
  '23-27 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        ips|um</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        ipsu|m</div>',
  '23-28 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        ipsu|m</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        ipsum|</div>',
  '23-29 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        ipsum|</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl">Lorem\n        <div></div>\n        ipsum|</div>',
  '23-30 rtl left character');
</script>
